package com.stone.serverless.test1.controller;

import com.stone.serverless.test1.NeedOutServiceManager;
import com.stone.serverless.test1.service.Test1Service;
import com.stone.serverless.test2.controller.Test2OutService;
import com.stone.serverless.test2.domain.Test2VO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description: TODO
 * @Author: MECHREVO
 * @Date: 2022/1/13 9:53
 * @Version: 1.0.0
 */
@Controller
@RequestMapping("/sdd")
public class Test1Controller {

    @Autowired
    private Test1Service test1Service;

    @GetMapping("/test1")
    @ResponseBody
    public Test2VO test1() {
        NeedOutServiceManager.INSTANCE.eventBusService.listener("test", this::test1);
        NeedOutServiceManager instance = NeedOutServiceManager.INSTANCE;
        Test2OutService test2OutService = instance.test2OutService;
        Test2VO test2VO = new Test2VO();
        test2VO.setId("xx");
        Test2VO test2VO1 = test2OutService.test3(test2VO);
        test1Service.test1();
        return test2VO1;
    }
}
